<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>钛鑫精密</title>
  <link rel="stylesheet" href="css/swiper.4.4.2.min.css">
  <link rel="stylesheet" href="css/index.css">
  <script src="js/jquery2.1.4.js"></script>
  <script src="js/swiper.4.4.2.min.js"></script>
  <script src="js/index.js"></script>
<script>
;(function(doc, win, width){
    var docEl = doc.documentElement;
    var head = doc.getElementsByTagName("head")[0];
    var hFirst = head.firstChild || head.firstElementChild; 
    var cssEl = doc.createElement('style');
    //手机横屏，竖屏可在此处设置 
    var resizeEvt = 'orientationchange' in win ? 'orientationchange' : 'resize';
    var recalc = function() {   
        var x; 
        var n = win.devicePixelRatio;      
        if (n >= 3) {                
            x = 3;                    
        } else if (n >= 2){
            x = 2;
        } else {
            x = 1;
        }
        var clientWidth = docEl.clientWidth;
        if (!clientWidth) return;
        if(clientWidth>1920){
          clientWidth = 1920
        }
        var pxPerRem = 100*(clientWidth / width);
        cssEl.innerHTML = 'html{ font-size:' + pxPerRem + 'px!important; }';
        docEl.setAttribute("data-dpr", x);   //x 限制范围取值 1,2,3
        head.appendChild(cssEl);   
    };
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window,1920)
</script>
</head>
<body>
<h1 style="display: none;">钛鑫精密</h1>
<div class="wrap">
  <img src="imgs/sbg.png" alt="">

  <div class="type_wrap">
    <ul id="select">
      <li><span class="active">机械设备</span></li>
      <li><span>新能源</span></li>
      <li><span>LED显示屏</span></li>
      <li><span>建筑</span></li>
      <li><span>机器人</span></li>
      <li><span>无人机</span></li>
      <li><span>电力设备</span></li>
      <li><span>机电马达</span></li>
      <li><span>家电</span></li>
      <li><span>自行车</span></li>
    </ul>
    <div class="type_wrap_img" id="type_wrap_img">
  
    </div>
  </div>

  <div class="swiper swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide"><img src="imgs/logo/1.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/2.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/3.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/4.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/5.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/6.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/7.png" alt=""></div>
      <div class="swiper-slide"><img src="imgs/logo/8.png" alt=""></div>
    </div>
  </div>
</div>


<script>
var arr = [
  ['半圆头十字','沉头十字防松螺丝','圆柱头内六角半牙长螺丝','圆柱头内六角防松螺丝','组合螺丝'],
  ['半圆头内六角螺丝','半圆头十字螺丝','沉头十字防松螺丝','圆柱头内六角螺丝','组134'],
  ['十字尖尾自攻螺丝','十字尖尾自攻螺丝1','十字尖尾自攻螺丝2','十字尖尾自攻螺丝3','组101'],
  ['半圆头十字尖尾自攻螺丝','外六角带介自攻自钻螺丝','圆柱头内六角','圆柱头内六角1','圆柱头内六角2'],
  ['BT头内六角自攻螺丝','半圆头十字防松螺丝','沉头十字防松螺丝','平头十字螺丝','圆柱头内六角螺丝'],
  ['BT头内六角自攻螺丝','平头内六角螺丝','圆柱头内六角CD纹防松螺丝','圆柱头内六角防松螺丝','圆柱头内六角自攻螺丝'],
  ['半圆头十字','沉头梅花螺丝','平头十字台阶螺丝','圆柱头内六角','圆柱头内六角防松螺丝'],
  ['半圆头十字带介螺丝','半圆头十字螺丝','半圆头十字螺丝1','外六角带介螺丝','圆柱头组合螺丝'],
  ['半圆头十字自攻','沉头十字防松螺丝','沉头十字螺丝','平头十字自攻','圆柱头Y型螺丝'],
  ['半圆头内六角','半圆头十字螺丝','异型半牙螺丝','圆柱头内六角','圆柱头内六角螺丝']
]

  setHTML(0, 'imgs/item1/');

  function setHTML(i,before_url){
    var html = `
    <div class="item"><span>${arr[i][0]}</span><div class="mask"></div><img src="${before_url}1.png"></div>
    <div class="item"><span>${arr[i][1]}</span><div class="mask"></div><img src="${before_url}2.png"></div>
    <div class="item"><span>${arr[i][2]}</span><div class="mask"></div><img src="${before_url}3.png"></div>
    <div class="item"><span>${arr[i][3]}</span><div class="mask"></div><img src="${before_url}4.png"></div>
    <div class="active item"><span>${arr[i][4]}</span><div class="mask"></div><img src="${before_url}5.png"></div>  
    `;
    $("#type_wrap_img").html(html)
  }

  $("#select li").click(function(){
    $(this).find('span').addClass('active')
    $(this).siblings().find('span').removeClass("active")
    var i = $(this).index();
    var before_url = 'imgs/item'+(i+1)+'/';
    setHTML(i,before_url)

  })

  $("#type_wrap_img").on('mouseover','.item',function(){
    $(this).addClass('active').siblings().removeClass('active')
  })


  // 底部logo轮播
  var mySwiper = new Swiper('.swiper-container',{
    grabCursor : true,
    speed:3000,
    autoplay:true, 
    slidesPerView : 4,
    spaceBetween : 20,
    loop:true,                        //环路
    speed:500,                        //滑动速度
    autoplay: {
      delay: 1000,                       //自动播放间隔
      disableOnInteraction:false,     //用户操作后继续自动播放
    },
  })


</script>


</body>
</html>